package cn.wolfcode.crm.mapper;

import cn.wolfcode.crm.domain.Employee;
import cn.wolfcode.crm.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface EmployeeMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Employee record);

    Employee selectByPrimaryKey(Long id);

    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);

    // 高级 查询
    int queryCount(QueryObject qo);
    List<Employee> queryList(QueryObject qo);

    // 用于 shiro 和 验证 用户名
    Employee selectByUsername(String name);

    // 复职 / 离职
    void changeState(Long id);

    // 维护 employee_role
    void insertRoleRelation(@Param("employeeId") Long employeeId,
                            @Param("roleId") Long roleId);

    void deleteRoleRelation(Long employeeId);

    //根据负责人的名字查询准确的人
    Long selectByPrincipalName(String principal);

    List<Map<String,Object>>  selectName();
}